package com.medicine.hbp.adapter;

import org.kymjs.kjframe.KJBitmap;
import org.kymjs.kjframe.widget.RoundImageView;

import android.app.Activity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.medicine.hbp.R;
import com.medicine.hbp.base.MyBaseAdapter;
import com.medicine.hbp.mob.findlistbyuseridVo;
import com.medicine.hbp.uitl.CommUtil;

public class MyMoneyAdapter extends MyBaseAdapter {
	private LayoutInflater inflater;
	KJBitmap bitmap=new KJBitmap();
	public MyMoneyAdapter(Activity activity) {
		this.activity =activity;
		inflater = LayoutInflater.from(activity);
	}

	@Override
	public View getView(int position, View view, ViewGroup arg2) {
		ViewHolder holder;
		if (view == null) {
			holder = new ViewHolder();
			view = inflater.inflate(R.layout.item_my_money, null);
			holder.img_userhead=(RoundImageView) view.findViewById(R.id.img_userhead);
			holder.txt_name=(TextView) view.findViewById(R.id.txt_name);
			holder.txt_time=(TextView) view.findViewById(R.id.txt_time);
			holder.txt_money=(TextView) view.findViewById(R.id.txt_money);
			view.setTag(holder);
		} else {
			holder = (ViewHolder) view.getTag();
		}
		final findlistbyuseridVo vo=(findlistbyuseridVo) getItem(position);
		if(vo!=null){
			if(!TextUtils.isEmpty(vo.userName)){
				holder.txt_name.setText(vo.userName);
			}
			bitmap.display(holder.img_userhead, vo.userHeadImg);
			holder.txt_time.setText(CommUtil.transForDateInChinese(vo.date));
			holder.txt_money.setText("￥"+vo.payRewardPrice);
		}
		return view;
	}

	class ViewHolder {
		TextView txt_name;
		TextView txt_time;
		TextView txt_money;
		RoundImageView img_userhead;
	}
}
